/* ==================================================================   
 * Created [2009-4-27 下午11:32:55] by Jon.King 
 * ==================================================================  
 * TSS 
 * ================================================================== 
 * mailTo:jinpujun@hotmail.com
 * Copyright (c) Jon.King, 2009-2012 
 * ================================================================== 
 */

package com.jinhe.tss.component.support.persistence.pagequery;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;
 
public class Condition extends MacrocodeQueryCondition{
    
    private String name = "";
    private Long id = null;

    private Date date = new Date();

    private Long[] pids = new Long[] { new Long(2), new Long(3), new Long(4) };

    private PageInfo page = new PageInfo();
 
    public Date getDate() {
        return date;
    }
 
    public void setDate(Date date) {
        this.date = date;
    }
 
    public Long getId() {
        return id;
    }
 
    public void setId(Long id) {
        this.id = id;
    }
 
    public String getName() {
        return name;
    }
 
    public void setName(String name) {
        this.name = name;
    }
 
    public Long[] getPids() {
        return pids;
    }
 
    public void setPids(Long[] pids) {
        this.pids = pids;
    }

    public Map<String, Object> getConditionMacrocodes() {
        Map<String, Object> macros = new HashMap<String, Object>();
        macros.put("${date}", " or t.date = :date");
        macros.put("${id}", " or t.id = :id");
        macros.put("${pids}", " and t.pid in (:pids)");
        macros.put("${name}", " and t.name like :name");
        return macros;
    }

    public PageInfo getPage() {
        return page;
    }
}
